An END DEF statement has no corresponding DEF statement. Also check other control structures within the DEF...END DEF structure and verify that they are correctly matched. For example, an IF without a matching ENDIF inside the DEF...END DEF structure generates this error.